package com.chentf.reggie.demo;

import sun.rmi.log.LogInputStream;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chentengfei
 * @desc ...
 * @date 2022-11-15 23:28:49
 */
public class ListGroup {

    public static void main(String[] args) {
        List list = new ArrayList();
        list.add("A");
        list.add("B");
        list.add("A");
        list.add("1");
        list.add("A");

//        System.out.println(list);
        int startIndex = 0;
        int endIndex = 1;
        int size = list.size();
        List<String> listNew = new ArrayList<>();
        while(startIndex < endIndex){
            for (int i = 1;i < list.size();i++){
                String result = list.get(i).toString();
                endIndex ++;
                if(! "A".equals(result)){
                    listNew = list.subList(startIndex,endIndex);
                    System.out.println(listNew);
                    startIndex = endIndex;
                }
            }
            listNew = list.subList(startIndex,endIndex);
            System.out.println(listNew);
            startIndex = endIndex;
        }


    }
}
